﻿@model ScrumProject.Models.Project

@{
    ViewBag.Title = "Edit";
}

<h2>Edit Project</h2>

<script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>

@using (Html.BeginForm()) {
    @Html.ValidationSummary(true)
    <fieldset>
        <legend>Project</legend>

        @Html.HiddenFor(model => model.Id)

        <div class="editor-label">
            @Html.LabelFor(model => model.Name)
        </div>
        <div class="editor-field">
            @Html.TextBoxFor(model => model.Name, new { style="width:500px"})
            @Html.ValidationMessageFor(model => model.Name)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.Description)
        </div>
        <div class="editor-field">
            @*@Html.EditorFor(model => model.Description)*@
            @Html.TextAreaFor(model => model.Description, new { rows = 10, cols = 40, name = "post", style = "width: 500px; height: 100px;" })
            @Html.ValidationMessageFor(model => model.Description)
        </div>

        <p>
            <input type="submit" value="Save" class="btn" />
        </p>
    </fieldset>
}

<center>
<table class="table table-bordered" style="width:700px">
    <tr>
        <th>
            Name
        </th>
        <th>
            Roles
        </th>
        <th>
            Actions
        </th>
    </tr>
@Html.ActionLink("Add User", "AddUser", new { projectId = Model.Id })

@foreach (var item in Model.Members) {
    <tr>
        <td>
            @Html.DisplayFor(modelItem => item.User.Username)
        </td>
        <td>
        @*using (Html.BeginForm("UserRole", "Project", new { user = item.User.Username, role = item.Role }))
        {
            <div class="editor-field">
            @Html.DropDownListFor(Members => item.Role, new SelectList(new ScrumProject.ViewModels.ProjectRolesViewModel().GetProjectRoles()), "Id", "Roles")
            <input type="submit" value="Save" class="btn" />
        </div>*@
            @Html.DisplayFor(modelItem => item.Role)
        </td>
        <td>
           @* @Html.ActionLink("Edit", "Edit", new { id=item.Id }) | *@
            @Html.ActionLink("Remove", "RemoveUser", new { id = item.Id })
        </td>
    </tr>
}

</table>
</center>
<div>
    @Html.ActionLink("Back to Projects List", "Index")
</div>
